<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <link rel="stylesheet" href="index1-2.css">

  <script>
    window.onload = function() {
      showTime()
    }
    function checkTime(i) {
      if(i < 10) {
        i = "0" + i
      }
      return i
    }
    function showTime() {
      var now = new Date()
      var year = now.getFullYear()
      var month = now.getMonth() + 1
      var day = now.getDate()
      var h = now.getHours()
      var m = now.getMinutes()
      var s = now.getSeconds()
      m = checkTime(m)
      s = checkTime(s)
      
      var weekday = ['星期天','星期一','星期二','星期三','星期四','星期五','星期六']

      document.getElementById('show').innerHTML = '' + year + '年' + month + '月' + day + '日 ' + weekday[now.getDay()] + h +':' + m +':' + s
      t = setTimeout('showTime()', 500)
    }
  </script>
</head>
<body>
  <div class="content1">
    <div id="show">显示时间的位置</div>
  </div>
</body>
</html>